package com.gxa.controller;


import com.gxa.common.R;
import com.gxa.pojo.Resume;
import com.gxa.pojo.talentsave.*;
import com.gxa.service.TalentSaveService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@Api(value = "人才储存接口",tags = "人才储存接口API")
@RequestMapping(value = "/TalentSave/*")
public class TalentSaveController {
    @Autowired
    private TalentSaveService talentSaveService;
    /**
     * 查找单个人才信息接口
     * @param
     * @return
     */
    @RequestMapping(value = "/queryTalentInfo",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "查找单个人才信息接口",notes = "查找",httpMethod = "POST", response = MyPages.class)
//    @ApiImplicitParam(name = "resumeinfo",value = "经历表信息",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })

//    public R queryTalentInfo(@RequestParam(name="resumeinfo") Object resumeinfo){
    public R queryTalentInfo(@RequestBody MyPages myPages){
        R r = talentSaveService.queryTalentInfo(myPages);
        return r;
    }

    /**
     *查询所有人才信息接口
     * @param myPages
     * @return
     */
    @RequestMapping(value = "/showTalentInfo",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "查询所有人才信息接口",notes = "查询全部信息",httpMethod = "POST", response = XzhResume.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showTalentInfo(@RequestBody MyPages myPages){
        R r = talentSaveService.showTalentInfo(myPages);
        return r;
    }

    /**
     * 查看单个人才信息接口
     * @param
     * @return
     */
    @RequestMapping(value = "/showDetailedInfo",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "查看单个人才具体信息接口",notes = "查找",httpMethod = "POST", response = Resume.class)
    //@ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showDetailedInfo(@RequestBody ReturnResume_id returnResume_id){

        R r = talentSaveService.showDetailedInfo(returnResume_id);
        return r;
    }
    /**
     * 显示未查看简历
     * @param
     * @return
     */
    @RequestMapping(value = "/notCheckResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未查看简历",notes = "显示",httpMethod = "GET", response = R.class)
    //@ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R notCheckResume(){
        R r = talentSaveService.notCheckResume();
        return r;
    }
    /**
     * 显示未录用简历
     * @param
     * @return
     */
    @RequestMapping(value = "/notEmployResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示未录用简历",notes = "显示",httpMethod = "GET", response = R.class)
    //@ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R notEmployResume(){
        R r = talentSaveService.notEmployResume();
        return r;
    }
    /**
     * 显示已经录用简历
     * @param
     * @return
     */
    @RequestMapping(value = "/alreadyEmployResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示已经录用简历",notes = "显示",httpMethod = "GET", response = R.class)
    //@ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R alreadyEmployResume(){
        R r = talentSaveService.alreadyEmployResume();
        return r;
    }

    /**
     * 显示已经工作的简历
     * @param
     * @return
     */
    @RequestMapping(value = "/alreadyWorkResume",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "显示已经工作的简历",notes = "显示",httpMethod = "GET", response = R.class)
    //@ApiImplicitParam(name = "re_status",value = "状态",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R alreadyWorkResume(){
        R r = talentSaveService.alreadyWorkResume();
        return r;
    }
    /**
     * 显示未查看简历的具体信息
     * @param
     * @return
     */
    @RequestMapping(value = "/showNotCheckResume",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "显示未查看简历的具体信息",notes = "查找",httpMethod = "POST", response = ReturnResume_id.class)
    //@ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showNotCheckResume(@RequestBody ReturnResume_id returnResume_id){
        R r = talentSaveService.showNotCheckResume(returnResume_id);
        return r;
    }

    /**
     * 显示未录用简历的具体信息
     * @param returnResume_id
     * @return
     */
    @RequestMapping(value = "/showNotEmployResume",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "显示未录用简历的具体信息",notes = "查找",httpMethod = "POST", response = R.class)
   // @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showNotEmployResume(@RequestBody ReturnResume_id returnResume_id){
        R r = talentSaveService.showNotEmployResume(returnResume_id);
        return r;
    }

    /**
     * 显示已录用简历的具体信息
     * @param returnResume_id
     * @return
     */
    @RequestMapping(value = "/showAlreadyEmployResume",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "显示已经录用简历的具体信息",notes = "查找",httpMethod = "POST", response = R.class)
   // @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showAlreadyEmployResume(@RequestBody ReturnResume_id returnResume_id){
        R r = talentSaveService.showAlreadyEmployResume(returnResume_id);
        return r;
    }

    /**
     * 显示已工作简历的具体信息
     * @param returnResume_id
     * @return
     */
    @RequestMapping(value = "/showAlreadyWorkResume",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "显示已经工作简历的具体信息",notes = "查找",httpMethod = "POST", response = R.class)
   // @ApiImplicitParam(name = "resume_id",value = "经历表ID",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R showAlreadyWorkResume(@RequestBody ReturnResume_id returnResume_id){
        R r = talentSaveService.showAlreadyWorkResume(returnResume_id);
        return r;
    }


    /**
     * 查询员工所在部门下拉框的所有值
     * @param
     * @return
     */
    @RequestMapping(value = "/selectAllDept",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询员工所在部门下拉框的所有值",notes = "查询",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllDept(){
        R r = talentSaveService.selectAllDept();
        return  r;
    }

    /**
     * 查询职称下拉框的所有值
     * @param
     * @return
     */
    @RequestMapping(value = "/selectAllCompetent",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询职称下拉框的所有值",notes = "查询",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllCompetent (){
        R r = talentSaveService.selectAllCompetent();
        return  r;
    }

    /**
     * 查询应聘岗位下拉框值
     * @param
     * @return
     */
    @RequestMapping(value = "/selectAllPost",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询应聘岗位下拉框值",notes = "查询",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllPost (){
        R r = talentSaveService.selectAllPost();
        return  r;
    }

    @RequestMapping(value = "/feedbackTalent",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "简历反馈接口",notes = "简历反馈（0 录用，1 拒绝）",httpMethod = "POST", response = R.class)
    public R feedbackTalent(@RequestBody UpdateResume updateResume){
        System.out.println("接收前端"+updateResume.toString());
        System.out.println("接收前端"+updateResume.getRe_remark());

        R r = talentSaveService.feedbackTalent(updateResume);

        return  r;
    }

    /**
     * @param
     * @return
     */
    @RequestMapping(value = "/joinTheStaff",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "已录用人员入职接口",notes = "入职",httpMethod = "POST", response = R.class)
    public R joinTheStaff(@RequestBody InsertEmpUpdateResume insertEmpUpdateResume){
        System.out.println("接收前端"+insertEmpUpdateResume.toString());
        insertEmpUpdateResume.getEmp_joinTime();
        R r = talentSaveService.joinTheStaff(insertEmpUpdateResume);
        return  r;
    }
}
